package config;

import com.dao.UserDao;
import com.dao.UserDaoImpl;
import com.service.UserService;
import com.service.UserServiceImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration//这个外部类的Configuration注解不能省略
public class HelloConfigInnerConfig {

    //@Configuration //内部的类上面的Configuration注解是可以省略的，但不建议
    static class DaoConfig {
        @Bean
        public UserDao userDao() {
            return new UserDaoImpl();
        }
    }

    @Configuration
    static class ServiceConfig {
        @Bean
        public UserService userService() {
            return new UserServiceImpl();
        }
    }
}
